﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RedHouse.Data.Service;
using RedHouse.Data.Entities;
using RedHouse.Data.Base;
using RedHouse.Data;

namespace RedHouse.Web.UserControls
{
    public partial class UCMenuDetail : System.Web.UI.UserControl
    {
        public Guid MenuId { get; set; }
        private IDishService _dishService;
        public RedHouseCategory MenuDetail { get; set; }
        public List<RedHouseDish> Dishes { get; set; }
        public List<RedHouse.Data.Image> ImageList { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Initialize();
            }
        }

        public void Initialize()
        {
            if (MenuId != null)
            {
                _dishService = new DishService();
                Dishes = _dishService.GetAllDishByCategory(MenuId);
                ImageList = ImageService.Instance.GetAllImageByAssociatedId(MenuId);
                MenuDetail = CategoryService.Instance.GetCategoryByID(MenuId);
            }
        }
    }
}